﻿//第一题：数字统计
int main()
{
    int l, r;
    cin >> l >> r;
    int ret = 0;
    for (int i = l; i <= r; i++)
    {
        int tmp = i;
        while (tmp)
        {
            if (tmp % 10 == 2) ret++;
            tmp /= 10;
        }
    }
    cout << ret << endl;
    return 0;
}

//第二题：两个数组的交集 
class Solution
{
    bool hash[1001] = { false };
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2)
    {
        vector<int> ret;
        for (auto x : nums1)
        {
            hash[x] = true;
        }
        for (auto x : nums2)
        {
            if (hash[x])
            {
                ret.push_back(x);
                hash[x] = false;
            }
        }
        return ret;
    }
}

//第三题：点击消除
int main()
{
    string s, st;
    cin >> s;
    for (auto x : s)
    {
        if (st.size() && st.back() == x) st.pop_back();
        else st += x;
    }
    cout << (st.size() == 0 ? "0" : st) << endl;
    return 0;
}